package com.vftour.qichongbook.framework.secure.exception;

import com.vftour.qichongbook.framework.api.IResultCode;
import com.vftour.qichongbook.framework.api.ResultCode;
import lombok.Getter;

/**
 * SecureException
 *
 * @author 东东 | d@tke.store
 * @date 2022/7/1 19:59
 * @since 1.0
 */
public class SecureException extends RuntimeException {
    private static final long serialVersionUID = 2359767895161832954L;

    @Getter
    private final IResultCode resultCode;

    public SecureException(String message) {
        super(message);
        this.resultCode = ResultCode.UN_AUTHORIZED;
    }

    public SecureException(IResultCode resultCode) {
        super(resultCode.getMessage());
        this.resultCode = resultCode;
    }

    public SecureException(IResultCode resultCode, Throwable cause) {
        super(cause);
        this.resultCode = resultCode;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
